package com.supermap.originTest;

import com.supermap.analyst.spatialanalyst.OverlayAnalyst;
import com.supermap.analyst.spatialanalyst.OverlayOutputAttributeType;
import com.supermap.data.*;

public class Testhebing {

    public static void main(String[] args) {

        Workspace workspace = new Workspace();
        WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo("E:\\MapData\\202408\\合并测试\\WorkSpace.smwu");

        conInfo.setType(WorkspaceType.SMWU);
        workspace.open(conInfo);
        Datasource targetDatasource = workspace.getDatasources().get(1);
        union(targetDatasource,"aabb");

    }
    public static void union(Datasource resultDatasource, String resultFcName) {

        double tolerance = 0.000000000001;

        DatasetVector[] datasetVectors = new DatasetVector[3];
        for (int i = 0; i < 3; i++) {
            datasetVectors[i] = (DatasetVector) resultDatasource.getDatasets().get(i);
            System.out.println(datasetVectors[i].getEncodeType());
        }
        SteppedListener listener = new SteppedListener() {
            @Override
            public void stepped(SteppedEvent steppedEvent) {
                System.out.println(steppedEvent.getMessage());
            }

        };
        DatasetVector resultDataVector = OverlayAnalyst.union(datasetVectors, OverlayOutputAttributeType.ALL, tolerance, resultDatasource, resultFcName, listener);
        resultDataVector.close();
        resultDataVector.dispose();
    }
}
